package spade;

class NOTTemplate extends BehaviourTemplate
{
	BehaviourTemplate	expr;

	public NOTTemplate(BehaviourTemplate ex)
	{
		expr = ex;
	};

	public boolean match(ACLMessage message)
	{
		return !(expr.match(message));
	};

};

class ORTemplate extends BehaviourTemplate
{
	BehaviourTemplate	expr1;
	BehaviourTemplate	expr2;

	public ORTemplate(BehaviourTemplate ex1, BehaviourTemplate ex2)
	{
		expr1 = ex1;
		expr2 = ex2;
	};

	public boolean match(ACLMessage message)
	{
		return (expr1.match(message) || expr2.match(message));
	};
};

class ANDTemplate extends BehaviourTemplate
{
	BehaviourTemplate	expr1;
	BehaviourTemplate	expr2;

	public ANDTemplate(BehaviourTemplate ex1, BehaviourTemplate ex2)
	{
		expr1 = ex1;
		expr2 = ex2;
	};

	public boolean match(ACLMessage message)
	{
		return (expr1.match(message) && expr2.match(message));
	};
};

class XORTemplate extends BehaviourTemplate
{
	BehaviourTemplate	expr1, expr2;

	public XORTemplate(BehaviourTemplate ex1, BehaviourTemplate ex2)
	{
		expr1 = ex1;
		expr2 = ex2;
	};

	public boolean match(ACLMessage message)
	{
		return (expr1.match(message) ^ expr2.match(message));
	};
};



